/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.kungkhies.persistence.entities;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Embeddable;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 *
 * @author clayton
 */
@Embeddable 
public class TagsPK implements Serializable 
{
    @Basic(optional = false)
    @NotNull
    @Column(name = "kungkhie_id")
    private long kungkhieId;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 500)
    @Column(name = "tag")
    private String tag;

    public TagsPK()
    {
    }

    public TagsPK(long kungkhieId, String tag)
    {
        this.kungkhieId = kungkhieId;
        this.tag = tag;
    }

    public long getKungkhieId()
    {
        return kungkhieId;
    }

    public void setKungkhieId(long kungkhieId)
    {
        this.kungkhieId = kungkhieId;
    }

    public String getTag()
    {
        return tag;
    }

    public void setTag(String tag)
    {
        this.tag = tag;
    }

    @Override
    public int hashCode()
    {
        int hash = 0;
        hash += (int) kungkhieId;
        hash += (tag != null ? tag.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object)
    {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof TagsPK))
        {
            return false;
        }
        TagsPK other = (TagsPK) object;
        if (this.kungkhieId != other.kungkhieId)
        {
            return false;
        }
        if ((this.tag == null && other.tag != null) || (this.tag != null && !this.tag.equals(other.tag)))
        {
            return false;
        }
        return true;
    }

    @Override
    public String toString()
    {
        return "com.kungkhies.persistence.entities.TagsPK[ kungkhieId=" + kungkhieId + ", tag=" + tag + " ]";
    }

}
